export default {
    state: {
        user: localStorage.getItem("bmob") ? JSON.parse(localStorage.getItem("bmob")) : {}
    },
    getters: {
        getUser: state => state.user
    },
    mutations: {
        setUser(state, data) {
            state.user = data;
        },
        logout(state) {
            state.user = {};
        }
    },
    actions: {
        setUser(context, payload) {
            context.commit("setUser", payload);
            console.log("setUser ok!");
        },
        logout(context) {
            context.commit("logout");
            console.log("logout user ok!")
        }
    }
}